<?php
/*
 * Created on Dec 2, 2010
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
final class GanCouponLink
{
	public $id;	// db id
	public $kind;
	
	public $linkId;
	public $advertiserId;
	
	public $name;
	public $isActive;
	
	public $destinationUrl;
	public $description;
	
	public $linkType;

	public $startDate;
	public $endDate;
	
	public $imageAltText;
	
	public $availability;
	public $authorship;
	public $promotionType;
	public $duration;
	public $createDate;
	
	public $impressionTrackingUrl;
	public $clickTrackingUrl;
	
	public $esdaAmount;
	public $esdaCurrencyCode;
	
	public $endaAmount;
	public $endaCurrencyCode;
	
	public $soPromoCodes;
	public $soPercentOff;
	
	public $sopomAmount;
	public $sopomCurrencyCode;
	
	public $sopcAmount;	
	public $sopcCurrencyCode;
	public $sopcmAmount;
	public $sopcmCurrencyCode;
	
	public $soFreeShipping;	
	public $sofsmAmount;
	public $sofsmCurrencyCode;
	public $soFreeGift;
	
	public $r_requestApiTime;	// request api get data time
	public $r_couponId;
	public $r_catId;
	public $r_recommend;
	public $r_matched;

	/* Price cut on the purchase. The amount of money.
	 * @return double
	 */
	public function setSpecialOffers($specialOffers)
	{
		if(!is_object($specialOffers))
			return -1;
		
		if(is_object($specialOffers->priceCut)){
			$this->sopcAmount = $specialOffers->priceCut->amount;
			$this->sopcCurrencyCode = $specialOffers->priceCut->currencyCode;		
		}		

		
		if(is_object($specialOffers->priceCutMin)){
			$this->sopcmAmount = $specialOffers->priceCut->amount;
			$this->sopcmCurrencyCode = $specialOffers->priceCut->currencyCode;		
		}		
		
		
		if(isset($specialOffers->freeShipping)){
			$this->soFreeShipping = $specialOffers->freeShipping;			
		}		
		if(is_object($specialOffers->freeShippingMin)){
			$this->sofsmAmount = $specialOffers->freeShippingMin->Amount;
			$this->sofsmCurrencyCode = $specialOffers->freeShippingMin->currencyCode;		
		}
		
		
		if(isset($specialOffers->percentOff)){
			$this->soPercentOff = $specialOffers->percentOff;			
		}
		if(is_object($specialOffers->percentOffMin)){
			$this->sopomAmount = $specialOffers->percentOffMin->Amount;
			$this->sopomCurrencyCode = $specialOffers->percentOffMin->currencyCode;		
		}
		
		
		if(isset($specialOffers->freeGift)){
			$this->soFreeGift = $specialOffers->freeGift;			
		}
		
		if(is_array($specialOffers->promotionCodes)){
			$this->soPromoCodes = implode(',', $specialOffers->promotionCodes);			
		}
	}
	
	public function setEpcSevenDayAverage($epcSevenDayAverage)
	{
		if(!is_object($epcSevenDayAverage))
			return -1;
		
		if(isset($epcSevenDayAverage->amount)){
			$this->esdaAmount = $epcSevenDayAverage->amount;			
		}		
		if(isset($epcSevenDayAverage->currencyCode)){
			$this->esdaCurrencyCode = $epcSevenDayAverage->currencyCode;			
		}
	}
	
	public function setEpcNinetyDayAverage($epcNinetyDayAverage)
	{
		if(!is_object($epcNinetyDayAverage))
			return -1;
		
		if(isset($epcNinetyDayAverage->amount)){
			$this->endaAmount = $epcSevenDayAverage->amount;			
		}		
		if(isset($epcNinetyDayAverage->currencyCode)){
			$this->endaCurrencyCode = $epcNinetyDayAverage->currencyCode;			
		}
	}
	
}
?>
